'\" t
.\"     Title: coap-server
.\"    Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 12/27/2024
.\"    Manual: coap-server Manual
.\"    Source: coap-server 4.2.0
.\"  Language: English
.\"
.TH "COAP\-SERVER" "5" "12/27/2024" "coap\-server 4\&.2\&.0" "coap\-server Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
coap-server \- CoAP Server based on libcoap
.SH "SYNOPSIS"
.sp
\fBcoap\-server\fR [\fB\-d\fR max] [\fB\-g\fR group] [\fB\-l\fR loss] [\fB\-p\fR port] [\fB\-v\fR num] [\fB\-A\fR address] [\fB\-N\fR] [[\fB\-k\fR key] [\fB\-h\fR hint]] [[\fB\-c\fR certfile] [\fB\-n\fR] [\fB\-C\fR cafile] [\fB\-R\fR root_cafile]]
.SH "DESCRIPTION"
.sp
\fBcoap\-server\fR is an example server for the \*(AqConstrained Application Protocol` (RFC 7252)\&.
.SH "OPTIONS \- GENERAL"
.PP
\fB\-d\fR max
.RS 4
Enable support for creation of dynamic resources when doing a PUT up to a limit of max\&. If max is reached, a 4\&.06 code is returned until one of the dynamic resources has been deleted\&.
.RE
.PP
\fB\-g\fR group
.RS 4
Join specified multicast
\fIgroup\fR
on startup\&.
.RE
.PP
\fB\-p\fR port
.RS 4
The
\fIport\fR
on the given address will be listening for incoming connections\&. If (D)TLS is supported, then
\fIport\fR
+ 1 will also be listened on for (D)TLS connections\&. The default port is 5683 if not given any other value\&.
.RE
.PP
\fB\-l\fR list
.RS 4
Fail to send some datagrams specified by a comma separated list of numbers or number ranges (debugging only)\&.
.RE
.PP
\fB\-l\fR loss%
.RS 4
Randomly failed to send datagams with the specified probability \- 100% all datagrams, 0% no datagrams (debugging only)\&.
.RE
.PP
\fB\-v\fR num
.RS 4
The verbosity level to use (default 3, maximum is 9)\&. Above 7, there is increased verbosity in GnuTLS logging\&.
.RE
.PP
\fB\-A\fR addr
.RS 4
The local address of the interface which the server has to listen\&.
.RE
.PP
\fB\-N\fR
.RS 4
Send NON\-confirmable message for \e"observe\e" responses\&. If option
\fB\-N\fR
is not specified, a confirmable response will be sent\&. Even if set, every fifth response will still be sent as a confirmable response (RFC 7641 requirement)\&.
.RE
.SH "OPTIONS \- PSK"
.sp
(If supported by underlying (D)TLS library)
.PP
\fB\-h\fR hint
.RS 4
Pre\-shared key hint to use for inbound connections\&. The default is
\fICoAP\fR\&. This cannot be empty if defined\&.
.RE
.PP
\fB\-k\fR key
.RS 4
Pre\-shared key to use for inbound connections\&. This cannot be empty if defined\&.
\fBNote:\fR
if
\fB\-c cafile\fR
is defined, you need to define
\fB\-k key\fR
as well to have the server support both PSK and PKI\&.
.RE
.SH "OPTIONS \- PKI"
.sp
(If supported by underlying (D)TLS library)
.PP
\fB\-c\fR certfile
.RS 4
Use the specified PEM file which contains the CERTIFICATE and PRIVATE KEY information\&.
\fBNote:\fR
if
\fB\-k key\fR
is defined, you need to define
\fB\-c cafile\fR
as well to have the server support both PSK and PKI\&.
.RE
.PP
\fB\-n\fR
.RS 4
Disable the requirement for clients to have defined client certificates
.RE
.PP
\fB\-C\fR cafile
.RS 4
PEM file containing the CA Certificate that was used to sign the certfile defined using
\fB\-c certfile\fR\&. If defined, then the client will be given this CA Certificate during the TLS set up\&. Furthermore, this will trigger the validation of the client certificate\&. If certfile is self\-signed (as defined by
\fB\-c certfile\fR), then you need to have on the command line the same filename for both the certfile and cafile (as in
\fB\-c certfile \-C certfile\fR) to trigger validation\&.
.RE
.PP
\fB\-R\fR root_cafile
.RS 4
PEM file containing the set of trusted root CAs that are to be used to validate the server certificate\&. The
\fB\-C cafile\fR
does not have to be in this list and is "trusted" for the verification\&. Alternatively, this can point to a directory containing a set of CA PEM files\&.
.RE
.SH "EXAMPLES"
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Example
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
coap\-server \-A ::1
.fi
.if n \{\
.RE
.\}
.sp
Let the server listen on localhost (port \fI5683\fR)\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Example
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
coap\-server \-A ::1 \-k mysecretKey \-h myhint
.fi
.if n \{\
.RE
.\}
.sp
Let the server listen on localhost (port \fI5683\fR and \fI5684\fR) with the server set up for PSK authentication\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Example
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
coap\-server \-A ::1 \-p 13011
.fi
.if n \{\
.RE
.\}
.sp
The same, except the listening port is \fI13011\fR (and not the default port \fI5683\fR)\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Example
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
coap\-server \-A 2001:db8:81a8:0:6ef0:dead:feed:beef \-v 5
.fi
.if n \{\
.RE
.\}
.sp
The listening address is set to \fI2001:db8:81a8:0:6ef0:dead:feed:beef\fR and the verbosity level is set to \fI5\fR\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Example
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
coap\-server \-A 2001:db8:81a8:0:6ef0:dead:feed:beef \-g FF02::FD
.fi
.if n \{\
.RE
.\}
.sp
Set listening address to \fI2001:db8:81a8:0:6ef0:dead:feed:beef\fR and join the All CoAP Nodes multicast group \fIFF02::FD\fR\&.
.SH "FILES"
.sp
There are no configuration files\&.
.SH "EXIT STATUS"
.PP
\fB0\fR
.RS 4
Success
.RE
.PP
\fB1\fR
.RS 4
Failure (syntax or usage error; configuration error; document processing failure; unexpected error)
.RE
.SH "BUGS"
.sp
Please report bugs on the mailing list for libcoap: libcoap\-developers@lists\&.sourceforge\&.net
.SH "AUTHORS"
.sp
The libcoap project <libcoap\-developers@lists\&.sourceforge\&.net>
